<template>
  <div>
    <div class="info">
      <div @click="goVideo" class="left-img">
        <img :src="infoObj.image" alt="" />
        <div>
          <span>{{ infoObj.timer }}</span>
        </div>
      </div>
      <div class="right-info">
        <div class="title-box">
          <span @click="goVideo">{{ infoObj.title }}</span>
          <span v-if="infoObj.isCk">来自新片场</span>
        </div>
        <div class="adinfo" v-if="infoObj.isCk">
          影片作者：<span>{{ infoObj.author }}</span
          ><span></span>
        </div>
        <p class="pingfen">
          评分：<span>{{ infoObj.score }}</span>
        </p>
        <p class="text">{{ infoObj.text }}</p>
        <div class="bot">
          <span>{{ infoObj.releaseTime }}</span>
          <div class="icon">
            <p><span></span>{{ infoObj.count_comment }}</p>
            <p><span></span>{{ infoObj.count_like }}</p>
            <p><span></span>{{ infoObj.count_share }}</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapMutations } from "vuex";
export default {
  props: {
    infoObj: {
      type: Object,
    },
  },
  name: "Info",
  methods: {
    ...mapMutations(["setVideo"]),
    goVideo() {
      this.setVideo(this.infoObj);
      this.$router.push("/video");
    },
  },
};
</script>

<style lang="scss" scoped>
.info {
  display: flex;
  margin-top: 50px;
  .left-img {
    width: 300px;
    height: 200px;
    position: relative;
    margin-right: 30px;
    cursor: pointer;
    overflow: hidden;
    &:hover {
      img {
        transform: scale(1.1);
        transition: all 1s linear;
      }
    }
    img {
      width: 300px;
      height: 200px;
      display: block;
      transition: all 1s linear;
    }
    div {
      position: absolute;
      right: 0;
      bottom: 0;
      width: 100%;
      height: 40px;
      background-image: linear-gradient(
        to bottom,
        transparent,
        rgba(0, 0, 0, 0.5)
      );
      span {
        color: #fff;
        position: absolute;
        right: 6px;
        bottom: 4px;
      }
    }
  }
  .right-info {
    position: relative;
    width: 460px;
    .title-box {
      display: flex;
      align-items: center;
      margin: 4px 0 12px 0;
      span:nth-child(1) {
        font-weight: bold;
        font-size: 20px;
        margin-right: 5px;
        cursor: pointer;
        &:hover {
          color: #666;
        }
      }
      span:nth-child(2) {
        background-color: #5cbeff;
        color: #fff;
        font-size: 12px;
        padding: 4px;
      }
    }
    .adinfo {
      font-size: 14px;
      color: #999;
      margin-bottom: 12px;
      span:nth-child(1) {
        color: #333;
        font-weight: bold;
        margin-right: 3px;
      }
      span:nth-child(2) {
        display: inline-block;
        width: 16px;
        height: 16px;
        vertical-align: middle;
        background-image: url(https://www.vmovier.com/Public/Home/images/plus-v-p-12.png);
        background-repeat: no-repeat;
      }
    }
    .pingfen {
      font-size: 14px;
      color: #999;
      margin-bottom: 12px;
      span {
        color: #f7b42c;
        font-weight: bold;
      }
    }
    .text {
      font-size: 16px;
      color: #747f8c;
    }
    .bot {
      position: absolute;
      bottom: 0;
      left: 0;
      display: flex;
      justify-content: space-between;
      width: 100%;
      span {
        font-size: 12px;
        color: #999;
      }
      .icon {
        display: flex;
        p {
          display: flex;
          align-items: center;
          font-size: 12px;
          margin-left: 16px;
          color: #999;
          span {
            width: 18px;
            height: 18px;
            display: inline-block;
            background-repeat: no-repeat;
            background-size: 100%;
            margin-right: 5px;
          }
        }
        p:nth-child(1) {
          span {
            background-image: url(https://www.vmovier.com/Public/Home/images/comment.png);
          }
        }
        p:nth-child(2) {
          span {
            background-image: url(https://www.vmovier.com/Public/Home/images/like.png);
          }
        }
        p:nth-child(3) {
          span {
            background-image: url(https://www.vmovier.com/Public/Home/images/share.png);
          }
        }
      }
    }
  }
}
</style>